import irrlicht;

void main()
{
    IrrlichtDevice device = createDevice(E_DRIVER_TYPE.EDT_SOFTWARE, new UintDimension2D(640, 480),
										16, false, false, false, null);

	assert(device, "Unable to create device.");
	
	scope(exit) device.drop();
	device.setWindowCaption("Hello World!  D + Irrlicht.");

	IVideoDriver driver = device.getVideoDriver();
	ISceneManager smgr = device.getSceneManager();
    IGUIEnvironment guienv = device.getGUIEnvironment();

	guienv.addStaticText("Hello World!  This is Irrlicht with D", new IntRect(10,10,260,22), true);
	
	IAnimatedMesh mesh = smgr.getMesh("media/sydney.md2");
	assert(mesh, "Unable to load mesh.");
	
	IAnimatedMeshSceneNode node = smgr.addAnimatedMeshSceneNode(mesh);
	
	if(node)
	{
		node.setMaterialFlag(E_MATERIAL_FLAG.EMF_LIGHTING, false);
		node.setMD2Animation(EMD2_ANIMATION_TYPE.EMAT_STAND);
		node.setMaterialTexture(0, driver.getTexture("media/sydney.bmp"));
	}
	
	smgr.addCameraSceneNode(null, new FloatVector3D(0, 30, -40), new FloatVector3D(0,5,0));
	
	while(device.run())
	{
		driver.beginScene(true, true, new SColor(255,100,101,140));
		smgr.drawAll();
		guienv.drawAll();
		driver.endScene();
	}
}